# 1. 定义模型序列化器
from rest_framework import serializers

from goods.models import SKU
from orders.models import OrderInfo, OrderGoods


class OrderGoodsSerializer(serializers.ModelSerializer):
    class Meta:
        model = OrderGoods
        depth = 1
        # fields = '__all__'
        exclude = ['create_time', 'update_time', 'order']


class OrderInfoSerializer(serializers.ModelSerializer):
    order_goods = OrderGoodsSerializer(many=True)

    class Meta:
        model = OrderInfo
        # fields = '__all__'
        exclude = ['update_time']
